package com.shenzhen.horselive.ui.dialog;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupWindow;

import androidx.appcompat.widget.PopupMenu;

import com.shenzhen.horselive.R;

public class MyPoupWindows extends PopupWindow {
    private  OnJubaoClick  onJubaoClick;

    public void setOnJubaoClick(OnJubaoClick onJubaoClick) {
        this.onJubaoClick = onJubaoClick;
    }

    public MyPoupWindows(Context context) {
        super(context);
        View  view =  View.inflate(context,R.layout.item_jubao_popup,null);
       initView(view);
       setContentView(view);
    }

    private void initView(View view) {
        //点击事件
        setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
        setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        setBackgroundDrawable(new ColorDrawable(0x00FFFFFF));
        setFocusable(true);
        setOutsideTouchable(true);

        ImageView  imageView = view.findViewById(R.id.img_jubao);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                if (onJubaoClick!=null)
                {
                    onJubaoClick.OnClick();
                }
            }
        });
    }



    public interface OnJubaoClick{
        void  OnClick();
    }


}
